package com.candy.control;
import com.alipay.api.AlipayApiException;

import com.candy.bean.AlipayBean;
import com.candy.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 支付宝沙箱测试
 *
 * @author 小道仙
 * @date 2020年2月17日
 */
@RestController
public class PayController {

    @Autowired
    private PayService payService;


    @RequestMapping(value = "order/alipay")
    public String alipay(@RequestBody AlipayBean alipayBean) throws AlipayApiException {
//        AlipayBean alipayBean = new AlipayBean();
        alipayBean.setOut_trade_no(alipayBean.getOut_trade_no());
        alipayBean.setSubject(alipayBean.getSubject());
        alipayBean.setTotal_amount(alipayBean.getTotal_amount());
        alipayBean.setBody(alipayBean.getBody());
        return payService.aliPay(alipayBean);
    }

}
